﻿@using LotteryVoteMVC.Models
@using LotteryVoteMVC.Resources
@using LotteryVoteMVC.Utility
@model PagedList<ActionLog>
@{
    ViewBag.Title = Resource.Action + Resource.Log;
    Layout = "~/Views/Shared/Main.cshtml";
}
@section Header{
    <script src="@Url.Content("~/Scripts/Customer/SearchHelper.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker-" + CultureHelper.GetCurrentCulture() + ".js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.theme.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.datepicker.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/TableBase.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Pager/pagerGray.css")" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(document).ready(function () {
            $("#FromDate,#ToDate").attr("readonly", "readonly").datepicker();
        });
    </script>
}
@{int index = 1;}
<div id="searchBar">
    @using (Html.BeginForm())
    {
        <span>@Resource.From</span>
        @Html.TextBox("FromDate")
        <span>@Resource.To</span>
        @Html.TextBox("ToDate")
        <span>@Resource.Target</span>
        @Html.TextBox("UserName")
        <input type="submit" name="search" id="search" value="@Resource.Search" />
    }
</div>
<table>
    <thead>
        <tr>
            <td>@Resource.No
            </td>
            <td>@Resource.Action
            </td>
            <td>
                @Resource.Target
            </td>
            <td>@Resource.Detail
            </td>
            <td>@Resource.IPAddress
            </td>
            <td>@Resource.Time
            </td>
        </tr>
    </thead>
    <tbody>
        @foreach (var log in Model)
        { 
            <tr>
                <td>@(index++)
                </td>
                <td>
                    @(Log.ResourceManager.GetString(log.Action) ?? log.Action)
                </td>
                <td>
                    @log.TargetUser.UserName
                </td>
                <td>@log.Detail
                </td>
                <td>@log.IPAddress
                </td>
                <td>@log.CreateTime
                </td>
            </tr>
        }
    </tbody>
</table>
@Html.Pager(Model)
